package com.itrip.utils.exception;

import com.itrip.utils.constants.ResultCodeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @Author: 周勉
 * @date: 2020/2/27 10:27
 */
@Data
@ApiModel(value = "全局异常")
public class ItripException extends RuntimeException {
    @ApiModelProperty(value = "获取码")
    private  Integer code;

    /**
     * 接受状态码消息
     * @param code
     * @param message
     */
    public ItripException(Integer code,String message){
        super(message);
        this.code=code;
    }

    /**
     * 接收枚举类型
     * @param resultCodeEnum
     */
    public ItripException(ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.code=resultCodeEnum.getCode();
    }
}
